package com.zhu.classfile.constant.base;

import com.zhu.classfile.constant.ConstantInfo;
import com.zhu.classfile.constant.ConstantTag;

import java.nio.ByteBuffer;

public class ConstantIntegerInfo implements ConstantInfo {
    private final ConstantTag tag = ConstantTag.CONSTANT_Integer;
    private int value;
    // private final ConstantPool cp;   多余！从“设计原则”看：最小依赖
    @Override
    public void readInfo(ByteBuffer reader) {
        value = reader.getInt();
    }

    public int getValue() {
        return value;
    }
    @Override
    public ConstantTag getTag() {
        return tag;
    }
}
